/**
 * If there are more the one cnzzID used in the page, the counted should be the first included.
 */

var _cnzzEventList = [
    /* ID,                  Category,       Action,     Label,          Value */
    ["1259118541_0001","导航","点击","首页",null],
    ["1259118541_0002","导航","点击","竞赛",null],
    ["1259118541_0003","导航","点击","规则",null],
    ["1259118541_0004","导航","点击","帮助",null],
    ["1259118541_0005","导航","点击","头像",null],
    ["1259118541_0006","导航","点击","我参与的",null],
    ["1259118541_0007","导航","点击","提现",null],
    ["1259118541_0008","导航","点击","个人信息",null],
    ["1259118541_0009","导航","点击","退出登录",null],
/*    ["1259118541_1101","首页banner","点击","项目1",null],
    ["1259118541_1102","首页banner","点击","项目2",null],
    ["1259118541_1103","首页banner","点击","项目3",null],*/
    ["1259118541_1201","首页页面按钮","点击","参加竞赛",null],
    ["1259118541_1202","首页页面按钮","点击","查看详情",null],
    ["1259118541_1203","首页页面按钮","点击","问题帮助",null],
    ["1259118541_2101","详情页选项卡","切换","简介",null],
    ["1259118541_2102","详情页选项卡","切换","参赛作品",null],
    ["1259118541_2103","详情页选项卡","切换","留言板",null],
    ["1259118541_2201","详情页按钮","点击","报名",null],
    ["1259118541_2202","详情页按钮","点击","上传作品",null],
    ["1259118541_2203","详情页链接","打开","保密协议",null],
    ["1259118541_3101","个人中心页选项卡","切换","我参与",null],
    ["1259118541_3102","个人中心页选项卡","切换","提现",null],
    ["1259118541_3103","个人中心页选项卡","切换","记录",null],
    ["1259118541_3201","个人中心页按钮","点击","上传作品",null],
    ["1259118541_3202","个人中心页按钮","点击","编辑",null]     
];

/**
 * e: System Event
 * eventId: The ID of cnzz event
 * o: this object
 */

function cnzzEvent(e, eventId, o) {
    var target = o.target, href = o.href, nodeId = o.id;
    
    var cnzzEvent = null;
    for(var item in _cnzzEventList) {
    if (!_cnzzEventList[item] || _cnzzEventList[item].length < 4) continue;

        var eId = _cnzzEventList[item][0];
        
        if (eId == eventId) {
            cnzzEvent = _cnzzEventList[item];
            break;
        }
    }
    
    if (cnzzEvent) {
        var categoryStr = cnzzEvent[1];
        var actionStr = cnzzEvent[2];
        var labelStr = cnzzEvent[3];
        var valueStr = cnzzEvent[4];

         _czc.push(['_trackEvent', categoryStr, actionStr, labelStr, valueStr, nodeId]);
    }

    if(!target || target == '_self') {
        var t;
        if(href) {
			t = setTimeout(function(){
				clearTimeout(t);
				location.href = href;
				return true;			
			}, 100);			
			if(e && e.preventDefault) {
				e.preventDefault();
			} else {
				window.event.returnValue = false;
			}
			return false;
		}	
    } else {
        if(href) {
            window.open(href);
            if(e && e.preventDefault) {
				e.preventDefault();
			} else {
				window.event.returnValue = false;
			}
            return false;
        }
    }
}

